package org.xhnews.services;

import java.util.Timer;
import java.util.TimerTask;

import org.xhnews.bo.NewsBo;
import org.xhnews.preferences.Preferences;

public class UpdateNewsService {
	Timer timer = new Timer();

	public void start() {
		timer.schedule(new UpdateNewsTask(), 60000, 1000*60*Preferences.message_update_interval);
	}
	
	public void stop(){
		timer.cancel();
	}

	class UpdateNewsTask extends TimerTask {
		public UpdateNewsTask() {
			// constructor
		}

		public void run() {
			NewsBo.updateAllEnableChannelNews();
			NewsBo.updateVideoItems();
		}

	}
}
